package org.sword.wechat4j;

import java.io.*;

/**
 * Created by wxc on 2016/8/9 0009.
 */
public class CodeParse {

    public static void main(String[] args) throws IOException {
        File in = new File("C:\\Users\\wxc\\Desktop\\code.txt");
        BufferedReader reader = new BufferedReader(new FileReader(in));

        File file = new File("C:\\Users\\wxc\\Desktop\\out.txt");
        if (!file.exists())
            file.createNewFile();
        PrintWriter out = new PrintWriter(file);

        out.println("String errmsg;");
        out.println("switch (errcode) {");
        String tmp;
        while ((tmp = reader.readLine()) != null) {
            out.println("   case "+ tmp +":");
            out.println("       errmsg = \"" + reader.readLine() + "\";");
            out.println("       break;");
        }

        out.println("   default:");
        out.println("       errmsg = \"未知错误\";");
        out.println("}");

        reader.close();
        out.close();
    }
}
